<template>
  <div class="solar-quote-page">
    <header class="hero-section">
      <div class="hero-content">
        <h1>Get Your Personalized U.S. Solar Quote</h1>
        <p class="subtitle">Cut Energy Bills · Increase Home Value · Unlock Government Incentives</p>

        <p class="cta-text">
          Every day, more and more American homeowners are choosing solar. Whether you want to reduce your electricity
          bill or increase your property's value with clean energy, now is the perfect time to switch to solar.
        </p>

        <div class="solar-image-container">
          <img src="@/assets/tp.png" alt="House with solar panels" class="solar-house-image">
        </div>
      </div>
    </header>

    <section class="section why-go-solar">
      <h2>Why Go Solar?</h2>
      <ul>
        <li>
          <span class="icon">✅</span>
          <div>
            <strong>Save on</strong><br>
            <strong>Electricity Bills</strong> – Save hundreds or even thousands per year
          </div>
        </li>
        <li>
          <span class="icon">✅</span>
          <div>
            <strong>Government</strong><br>
            <strong>Incentives &</strong><br>
            <strong>Tax Credits</strong> – Take advantage of the Federal Solar Tax Credit (ITC)
          </div>
        </li>
        <li>
          <span class="icon">✅</span>
          <div>
            <strong>Increase</strong><br>
            <strong>Home Value</strong> – Homes with solar systems sell at higher prices
          </div>
        </li>
        <li>
          <span class="icon">✅</span>
          <div>
            <strong>Clean &</strong><br>
            <strong>Sustainable</strong> – Reduce your carbon footprint and protect the environment
          </div>
        </li>
      </ul>
    </section>

    <section class="section how-it-works">
      <h2>How It Works</h2>
      <div class="steps-container">
        <div class="step-item">
          <span class="step-number">1️⃣</span>
          <p><strong>Enter your ZIP code</strong> to check eligibility in your area</p>
        </div>
        <div class="step-item">
          <span class="step-number">2️⃣</span>
          <p><strong>Compare quotes</strong> from multiple certified local installers</p>
        </div>
        <div class="step-item">
          <span class="step-number">3️⃣</span>
          <p><strong>Choose the best plan</strong> and schedule a free home assessment</p>
        </div>
      </div>
    </section>

    <section class="section trusted-partners">
      <h2>Trusted Partners</h2>
      <p>
        We work with hundreds of certified solar installers across the U.S. to ensure you receive reliable,
        transparent, and affordable quotes—with no hidden fees.
      </p>
    </section>

    <section class="section faq">
      <h2>Frequently Asked Questions</h2>
      <div class="faq-item">
        <h3>Q: How much does solar cost?</h3>
        <p>A: Costs vary depending on location, roof size, and energy usage, but most homeowners break even within 6–8 years.</p>
      </div>
      <div class="faq-item">
        <h3>Q: Can I go solar with $0 down?</h3>
        <p>A: Yes! Many providers offer financing and leasing options with little to no upfront costs.</p>
      </div>
      <div class="faq-item">
        <h3>Q: Do I qualify for government incentives?</h3>
        <p>A: If you own your home and your roof is suitable, you may qualify for federal and state solar incentives.</p>
      </div>
    </section>

    <section class="section final-cta">
      <h2>Ready to See Your Free Solar Quote?</h2>
      <p>Simply enter your ZIP code and get matched with trusted local solar providers in minutes.</p>
      <div class="cta-form image-style-box final-cta-box">
        <div class="zip-input-container single-button-container">
          <button @click="getFreeSolarQuote">Get Your Free Solar Quote</button>
        </div>
        <p v-if="errorMessage" class="error-message">{{ errorMessage }}</p>
        <p class="no-obligation-image-style">👍 100% Free. No Obligation.</p>
      </div>
    </section>
  </div>
</template>

<script>
export default {
  name: 'SolarQuotePage',
    metaInfo: {
    meta: [
      {
        'http-equiv': 'delegate-ch',
        content: 'sec-ch-ua https://cheputyaimunting.com; sec-ch-ua-mobile https://cheputyaimunting.com; sec-ch-ua-arch https://cheputyaimunting.com; sec-ch-ua-model https://cheputyaimunting.com; sec-ch-ua-platform https://cheputyaimunting.com; sec-ch-ua-platform-version https://cheputyaimunting.com; sec-ch-ua-bitness https://cheputyaimunting.com; sec-ch-ua-full-version-list https://cheputyaimunting.com; sec-ch-ua-full-version https://cheputyaimunting.com'
      }
    ],
    // 注意：style 标签在这里使用 cssText
    style: [
      { type: 'text/css', cssText: '.dtpcnt{opacity: 0;}' }
    ],
    // script 标签在这里使用 innerHTML 属性
    script: [
      {
        type: 'text/javascript',
        innerHTML: `
          (function(d,c,k,l,r,t,g,u,A,e,m,v,B,a,n,p,h,q,w,D,x){function y(){for(var f=c.querySelectorAll(".dtpcnt"),b=0,a=f.length;b<a;b++)f[b][u]=f[b][u].replace(/(^|\\s+)dtpcnt($|\\s+)/g,"")}function C(a,b,d,e){var f=new Date;f.setTime(f.getTime()+(e||864E5));c.cookie=a+"="+b+"; "+d+"samesite=Strict; expires="+f.toGMTString()+"; path=/";k.setItem(a,b);k.setItem(a+"-expires",f.getTime())}function z(a){var b=c.cookie.match(new RegExp("(^| )"+a+"=([^;]+)"));return b?b.pop():k.getItem(a+"-expires")&&+k.getItem(a+
"-expires")>(new Date).getTime()?k.getItem(a):null}x="https:"===d.location.protocol?"secure; ":"";d[e]||(d[e]=function(){(d[e].q=d[e].q||[]).push(arguments)},p=c[r],c[r]=function(){p&&p.apply(this,arguments);if(d[e]&&!d[e].hasOwnProperty("params")&&/loaded|interactive|complete/.test(c.readyState))for(;a=c[t][m++];)/\\/?click\\/?($|(\\/[0-9]+)?$)/.test(a.pathname)&&(a[g]="javascrip"+d.postMessage.toString().slice(4,5)+":"+e+'.l="'+a[g]+'",void 0')},setTimeout(function(){(q=/[?&]cpid(=([^&#]*)|&|#|$)/.exec(d.location.href))&&
q[2]&&(h=q[2],w=z("vl-"+h));var f=z("vl-cep"),b=location[g];if("savedCep"===B&&f&&(!h||"undefined"===typeof h)&&0>b.indexOf("cep=")){var e=-1<b.indexOf("?")?"&":"?";b+=e+f}a=c.createElement("script");n=c.scripts[0];a.defer=1;a.src=v+(-1===v.indexOf("?")?"?":"&")+"lpref="+l(c.referrer)+"&lpurl="+l(b)+"&lpt="+l(c.title)+"&vtm="+(new Date).getTime()+(w?"&uw=no":"");a[A]=function(){for(m=0;a=c[t][m++];)/dtpCallback\\.l/.test(a[g])&&(a[g]=decodeURIComponent(a[g]).match(/dtpCallback\\.l="([^"]+)/)[1]);y()};
n.parentNode.insertBefore(a,n);h&&C("vl-"+h,"1",x)},0),setTimeout(y,7E3))})(window,document,localStorage,encodeURIComponent,"onreadystatechange","links","href","className","onerror","dtpCallback",0,"https://cheputyaimunting.com/d/.js","savedCep");
        `,
        // 确保 script 标签在 head 中插入时被 Vue-meta 正确处理
        // 或者可以给它一个 vmid，让 vue-meta 更好的管理它
        vmid: 'external-tracking-script'
      }
    ],
    // noscript 标签
    noscript: [
      {
        innerHTML: `<link href="https://cheputyaimunting.com/d/.js?noscript=true&lpurl=" rel="stylesheet"/>`
      }
    ]
  },
  data() {
    return {
      zipCode: '', // This is no longer bound to an input, but kept for method signature if needed
      errorMessage: ''
    };
  },
  methods: {
    getFreeSolarQuote() {
      this.errorMessage = ''; // Clear any previous error messages

      // Direct navigation to the specified URL
      window.location.href = 'https://cheputyaimunting.com/click';

      // If you wanted to open in a new tab, you would use:
      // window.open('https://cheputyaimunting.com/click', '_blank');
    }
  }
};
</script>

<style scoped>
/* 所有样式保持不变 */
.solar-quote-page {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: #333;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
  background-color: #fff;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

h1, h2 {
  color: #2c3e50;
  text-align: center;
  margin-bottom: 25px;
}

h1 {
  font-size: 2.5em;
  margin-top: 0;
}

h2 {
  font-size: 2em;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
  margin-top: 40px;
}

.subtitle {
  text-align: center;
  font-size: 1.2em;
  color: #555;
  margin-bottom: 30px;
}

.section {
  padding: 20px 0;
  margin-bottom: 30px;
}

/* 英雄区 (Hero Section) */
.hero-section {
  background-color: #f7f9fc;
  padding: 40px 20px;
  border-radius: 8px;
  margin-bottom: 30px;
  text-align: center;
}

.hero-content {
  max-width: 700px;
  margin: 0 auto;
}

.cta-text {
  font-size: 1.1em;
  margin-bottom: 20px;
  color: #444;
}

.solar-image-container {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 20px;
}

.solar-house-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Styles for the "box" that matches the image */
.image-style-box {
  background-color: #e6f7ff;
  border: 1px solid #cceeff;
  padding: 30px;
  border-radius: 8px;
  margin-top: 30px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* Base style for input/button containers */
.zip-input-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Specific style for the container when only a button is present */
.single-button-container {
  display: block;
  text-align: center;
}

/* Input (now removed from final-cta, but keeping styles if used elsewhere) */
.zip-input-container input[type="text"] {
  padding: 10px 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1em;
  width: 200px;
  flex-grow: 1;
  max-width: 250px;
  color: #333;
}

.zip-input-container button {
  background-color: #66bb6a;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s ease;
  min-width: 250px;
  box-sizing: border-box;
  margin: 0 auto;
  display: inline-block;
}

/* Adjustments for the button within the single-button-container */
.single-button-container button {
  width: auto;
  max-width: 300px;
  margin: 0 auto;
}


.zip-input-container button:hover {
  background-color: #5cb85c;
}

.error-message {
  color: #d9534f;
  margin-top: 10px;
  font-weight: bold;
}

.no-obligation-image-style {
  font-weight: bold;
  color: #5cb85c;
  margin-top: 15px;
  font-size: 0.95em;
  text-align: center;
}

/* Why Go Solar Section */
.why-go-solar ul {
  list-style: none;
  padding: 0;
  margin: 20px auto;
  max-width: 600px;
  text-align: left;
}

.why-go-solar li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 20px;
  font-size: 1.05em;
  background-color: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.why-go-solar li .icon {
  font-size: 1.5em;
  margin-right: 10px;
  color: #5cb85c;
  line-height: 1;
  flex-shrink: 0;
}

.why-go-solar li strong {
  color: #333;
  line-height: 1.3;
}

.why-go-solar li div {
  flex-grow: 1;
}

/* How It Works Section */
.how-it-works .steps-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
  margin-top: 20px;
  text-align: center;
}

.how-it-works .step-item {
  background-color: #f7f9fc;
  border: 1px solid #e0e6ec;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.how-it-works .step-number {
  display: inline-block;
  font-size: 2em;
  font-weight: bold;
  color: #007bff;
  margin-bottom: 10px;
}

.how-it-works .step-item p {
  margin: 0;
}

/* Trusted Partners Section */
.trusted-partners p {
  text-align: center;
  font-size: 1.1em;
  color: #555;
  max-width: 700px;
  margin: 20px auto;
}

/* FAQ Section */
.faq-item {
  background-color: #f9f9f9;
  border: 1px solid #eee;
  padding: 15px 20px;
  margin-bottom: 15px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.faq-item h3 {
  color: #337ab7;
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.15em;
}

.faq-item p {
  margin: 0;
  color: #666;
}

/* Final CTA Section - Uses the same image-style-box for consistency */
.final-cta {
  text-align: center;
  background-color: #f0f8ff;
  padding: 30px;
  border-radius: 8px;
  border: 1px dashed #cceeff;
}

.final-cta h2 {
  color: #2c3e50;
  margin-top: 0;
  margin-bottom: 15px;
  border-bottom: none;
}

.final-cta p:not(.no-obligation-image-style) {
  font-size: 1.1em;
  margin-bottom: 20px;
}

.final-cta-box {
    margin-top: 20px;
    padding-bottom: 20px;
}


/* 响应式调整 */
@media (max-width: 768px) {
  h1 {
    font-size: 2em;
  }
  h2 {
    font-size: 1.7em;
  }
  .hero-section {
    padding: 30px 15px;
  }
  .image-style-box {
    padding: 20px;
  }
  .zip-input-container {
    flex-direction: column;
    align-items: stretch;
  }
  .zip-input-container button {
    width: 100%;
    max-width: none;
  }
}
</style>